//翻译
const { youdao, baidu, google } = require('translation.js')

async function translate(app, text) {
  let result = ''
  switch(app) {
    case 'youdao':
      result = (await youdao(text)).result[0]
      break
    case 'baidu':
      result = (await baidu(text)).result[0]
      break
    case 'google':
      result = (await google(text)).result[0]
      break
  }
  return result
}

module.exports = translate